package com.roomio.core.security.model;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.userdetails.UserDetails;

/** Demo Uswer Details Object 
 * It also added email and fullName attributes 
 */
public class DemoUserDetails implements UserDetails {
	private static final long serialVersionUID = 2992659214881509857L;
	
	private String userName;
	private String email;
	private String fullName;
	
	private Collection<GrantedAuthority> authorities;
	
	public DemoUserDetails(String userName, String email, String fullName) {
		this.userName = userName;
		this.email = email;
		this.fullName = fullName;
		
		authorities = new ArrayList<GrantedAuthority>();
		authorities.add(new GrantedAuthorityImpl("ROLE_USER"));
	}
	
	public Collection<GrantedAuthority> getAuthorities() {
		return authorities;
	}

	public String getEmail() {
		return email;
	}
	
	public String getFullName() {
		return fullName;
	}

	public String getUsername() {
		return userName;
	}

	public String getPassword() {
		return null;
	}
	
	public boolean isAccountNonExpired() {
		return true;
	}

	public boolean isAccountNonLocked() {
		return true;
	}

	public boolean isCredentialsNonExpired() {
		return true;
	}

	public boolean isEnabled() {
		return true;
	}
}
